﻿package mortal.common
{
    import flash.text.*;
    import mortal.common.font.*;

    public class GTextFormat extends TextFormat
    {
        protected var outSize:int = 12;

        public function GTextFormat(param1:String = null, param2:Object = null, param3:Object = null, param4:Object = null, param5:Object = null, param6:Object = null, param7:String = null, param8:String = null, param9:String = null, param10:Object = null, param11:Object = null, param12:Object = null, param13:Object = null)
        {
            super(param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13);
            if (param1)
            {
                this.font = param1;
            }
            else
            {
                this.font = FontUtil.defaultFont.fontName;
            }
            if (param2)
            {
                this.size = param2;
            }
            else
            {
                this.size = 12;
            }
            return;
        }// end function

        override public function set font(param1:String) : void
        {
            if (param1)
            {
                super.font = param1;
            }
            else
            {
                super.font = FontUtil.defaultFont.fontName;
            }
            this.updateSize();
            return;
        }// end function

        override public function set size(param1:Object) : void
        {
            if (param1)
            {
                this.outSize = int(param1);
            }
            else
            {
                this.outSize = 12;
            }
            this.updateSize();
            return;
        }// end function

        override public function get size() : Object
        {
            return this.outSize;
        }// end function

        protected function updateSize() : void
        {
            var _loc_1:* = FontName.getFontByName(this.font);
            if (_loc_1)
            {
                super.size = _loc_1.getFontSize(this.outSize);
            }
            else
            {
                super.size = this.outSize;
            }
            return;
        }// end function

        public function setColor(param1:uint) : GTextFormat
        {
            this.color = param1;
            return this;
        }// end function

        public function setFont(param1:String) : GTextFormat
        {
            this.font = param1;
            return this;
        }// end function

        public function setSize(param1:int) : GTextFormat
        {
            this.size = param1;
            return this;
        }// end function

        public function setBold(param1:Boolean) : GTextFormat
        {
            this.bold = param1;
            return this;
        }// end function

        public function setLeading(param1:int) : GTextFormat
        {
            this.leading = param1;
            return this;
        }// end function

        public function setLetterSpacing(param1:int) : GTextFormat
        {
            this.letterSpacing = param1;
            return this;
        }// end function

        public function setUnderline(param1:Boolean) : GTextFormat
        {
            this.underline = param1;
            return this;
        }// end function

        public function setIndent(param1:int) : GTextFormat
        {
            this.indent = param1;
            return this;
        }// end function

        override public function set leading(param1:Object) : void
        {
            var _loc_2:int = 0;
            if (!FontUtil.isHaveYahei())
            {
                _loc_2 = int(param1);
                _loc_2 = _loc_2 + 2;
                super.leading = _loc_2;
            }
            else
            {
                super.leading = param1;
            }
            return;
        }// end function

        public function center() : GTextFormat
        {
            this.align = TextFormatAlign.CENTER;
            return this;
        }// end function

        public function left() : GTextFormat
        {
            this.align = TextFormatAlign.LEFT;
            return this;
        }// end function

        public function right() : GTextFormat
        {
            this.align = TextFormatAlign.RIGHT;
            return this;
        }// end function

        public function clone() : GTextFormat
        {
            var _loc_1:* = new GTextFormat();
            _loc_1.align = this.align;
            _loc_1.blockIndent = this.blockIndent;
            _loc_1.bold = this.bold;
            _loc_1.bullet = this.bullet;
            _loc_1.color = this.color;
            _loc_1.display = this.display;
            _loc_1.font = this.font;
            _loc_1.indent = this.indent;
            _loc_1.italic = this.italic;
            _loc_1.kerning = this.kerning;
            _loc_1.leading = this.leading;
            _loc_1.leftMargin = this.leftMargin;
            _loc_1.letterSpacing = this.letterSpacing;
            _loc_1.rightMargin = this.rightMargin;
            _loc_1.size = this.size;
            _loc_1.tabStops = this.tabStops;
            _loc_1.target = this.target;
            _loc_1.underline = this.underline;
            _loc_1.url = this.url;
            return _loc_1;
        }// end function

    }
}
